<template>

  <div>
    <el-descriptions v-for="item in records" :key="item.companyId" direction="vertical"
                     :column="4" border>
      <div slot="title"><a @click="showInfo(item)" style="cursor: pointer">{{item.companyName}}</a></div>
      <el-descriptions-item label="地址">{{item.companyAddress}}</el-descriptions-item>
      <el-descriptions-item label="联系方式">{{item.companyPhone}}</el-descriptions-item>
      <el-descriptions-item label="官方网址" :span="2">{{item.companyWebsite}}</el-descriptions-item>
      <el-descriptions-item label="备注"></el-descriptions-item>
    </el-descriptions>
  </div>
</template>



<script>

export default {
  name: "u_company",
  data() {
    return {
      records: [],//接收所有公司信息数据
      dialogFormVisibleEdit: false,
      pagination: {//分页相关模型数据
        currentPage: 1,//当前页码
        pageSize: 9,//每页显示的记录数
        total: 0,//总记录数
        companyName: "",
        companyAddress: ""
      },
    }
  },
  created() {
    this.getAll();
  },
  methods: {
    getAll() {
      // 组织参数，拼接url请求地址
      let paramStr = "?companyName=" + this.pagination.companyName
          + "&companyAddress=" + this.pagination.companyAddress;
      this.axios
          .get("/company/page/" + this.pagination.currentPage + "/" + this.pagination.pageSize + paramStr)
          .then(res => {
        this.pagination.currentPage = res.data.data.current;
        this.pagination.pageSize = res.data.data.size;
        this.pagination.total = res.data.data.total;
        this.records = res.data.data.records;
        //this.loading = false;
      });
    },
    showInfo(item){
      this.$router.push({
        path: "/user_index/u_companyInfo",
        query:{
          companyId: item.companyId,
          companyHistory: item.companyHistory
        }
      })
    }
  }
}
</script>

<style scoped>

</style>